--region *.lua
--Date
--此文件由[BabeLua]插件自动生成
cc.exports.createLand = function()
    local land1 = cc.Sprite:create("land.png"):setTag(TAG.LAND)
    local land2 = cc.Sprite:create("land.png")
    local landWidth = land1:getContentSize().width
    local landHeight = land1:getContentSize().height

    local y = display.cy - bgHeight / 2
    land1:setAnchorPoint(0.5, 0)
    land1:setPosition(cc.p(display.cx, y))
    land2:setAnchorPoint(0.5, 0)
    land2:setPosition(cc.p(display.cx + landWidth, y))

    local function setScroll(delta)
        local x1, x2, speed = land1:getPositionX(), land2:getPositionX(), DELTAx
        x1 = x1 - speed
        x2 = x2 - speed

        if x1 <= display.cx - landWidth or x2 <= display.cx then
          x1 = display.cx 
          x2 = display.cx + landWidth
        end
        land1:setPositionX(x1)
        land2:setPositionX(x2)
    end
    
    local function getLands()
        return land1, land2
    end

    return {getLands = getLands,
            setScroll = setScroll
    }
end
--endregion
